//
//  CycleCollectionReusableView.m
//  22-QQ音乐MV界面
//
//  Created by 王宇飞 on 16/8/15.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "CycleCollectionReusableView.h"

@implementation CycleCollectionReusableView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
       
        [self createView:frame];
        [self createButton:frame];
    }
    return  self;
}
- (void)setMv_show_play:(NSArray<Mv_show_play *> *)mv_show_play {
    _mv_show_play = mv_show_play;
    NSMutableArray *arr = [NSMutableArray array];
    for (Mv_show_play *mv in mv_show_play) {
        [arr addObject:mv];
    }
    _cycleImageView = [[DMCCycleImages alloc] initWithFrame:self.frame];
    [self addSubview:_cycleImageView];
    _cycleImageView.array = arr;
    
}
- (void)createView:(CGRect)frame {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame) *3 / 5)];
    view.backgroundColor = [UIColor redColor];
    [self addSubview:view];
}
- (void)createButton:(CGRect)frame{
    UIButton *sceneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    UIButton *listButton = [UIButton buttonWithType:UIButtonTypeCustom];
    UIButton *channelButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    
    [sceneButton setTitle:@"现场" forState:UIControlStateNormal];
    [listButton setTitle:@"榜单" forState:UIControlStateNormal];
    [channelButton setTitle:@"频道" forState:UIControlStateNormal];
    sceneButton.frame = CGRectMake(0, 0, 80, CGRectGetHeight(frame) / 5);
    CGFloat centerX = frame.size.width / 2;
    CGFloat centerY = frame.size.height / 10 * 7;
    sceneButton.center = CGPointMake(centerX, centerY);
    
    listButton.frame = CGRectMake(0, 0, 80, CGRectGetHeight(frame) / 4);
    listButton.center = CGPointMake(centerX / 3, centerY);
    
    channelButton.frame = CGRectMake(0, 0, 80, CGRectGetHeight(frame) / 4);
    channelButton.center = CGPointMake(centerX / 3 * 5, centerY);
    
    [sceneButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [listButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [channelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
   
    [self addSubview:sceneButton];
    [self addSubview:listButton];
    [self addSubview:channelButton];
    
    UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(40, frame.size.height / 5 * 4, frame.size.width - 80, frame.size.height / 5)];
    labelTitle.textAlignment = NSTextAlignmentCenter;
    labelTitle.text = @"首播";
    labelTitle.textColor = [UIColor blackColor];
    [self addSubview:labelTitle];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:@"RecommendMoreBtnIcon"] forState:UIControlStateNormal];
    button.frame = CGRectMake(CGRectGetWidth(frame) - 45, CGRectGetHeight(frame) / 5 * 4, CGRectGetHeight(frame) / 5, CGRectGetHeight(frame) / 5);
    [self addSubview:button];
    
}
@end
